package com.ceadeal.admin.common.datatable;

import java.util.List;
import java.util.Map;

/**
 * DataTable JSON数据封装
 * Created by Yzw on 2016/7/29 0029.
 */
public class DataTableOutput<T> {
    private Integer draw;

    /**
     * 没有过滤的记录数
     */
    private Integer recordsTotal;

    /**
     * 过滤后的记录数
     */
    private Integer recordsFiltered;

    /**
     * DataTable中需要显示的数据
     */
    private List<T> data;

    /**
     * 可选，定义一个错误来描述服务器出了问题后的提示
     */
    private String error;

    private Map<String, Object> addInfo;

    public DataTableOutput() {
    }

    public DataTableOutput(Integer draw, Integer recordsTotal, List<T> data) {
        this.draw = draw;
        this.recordsTotal = recordsTotal;
        this.recordsFiltered = recordsTotal;
        this.data = data;
    }

    public DataTableOutput(Integer draw, Integer recordsTotal, List<T> data, String error) {
        this.draw = draw;
        this.recordsTotal = recordsTotal;
        this.recordsFiltered = recordsTotal;
        this.data = data;
        this.error = error;
    }

    public Integer getDraw() {
        return draw;
    }

    public void setDraw(Integer draw) {
        this.draw = draw;
    }

    public Integer getRecordsTotal() {
        return recordsTotal;
    }

    public void setRecordsTotal(Integer recordsTotal) {
        this.recordsTotal = recordsTotal;
    }

    public Integer getRecordsFiltered() {
        return recordsFiltered;
    }

    public void setRecordsFiltered(Integer recordsFiltered) {
        this.recordsFiltered = recordsFiltered;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public String getError() {
        return error;
    }

    public void setError(String error) {
        this.error = error;
    }

    public Map<String, Object> getAddInfo() {
        return addInfo;
    }

    public void setAddInfo(Map<String, Object> addInfo) {
        this.addInfo = addInfo;
    }
}
